<?php
        class maps extends model {
           
           function view(){ 
           
             if($_GET['productid'])
             {
             $productid=$_GET['productid'];
             if($_GET['date'])
             {
             $date= $_GET['date'];
             }
             
             $where="where productid=".$productid.' '.$where;
             $limit="limit  0,1";           
             $getproduct=$this->getproductbycondition($where,$limit,$orderby,$innerjoin,$groupby);
          // echo "follow";

          $krow=0;
          $arraylatlng=array();
          if(count($getproduct[0]['plugins']))
          {
          foreach($getproduct[0]['plugins'] as $valueplugins)
          {
              if($valueplugins['plugid']==16||$valueplugins['plugid']==32)
               {
               
                 if(count($valueplugins['objdata']))
                 {
                    foreach($valueplugins['objdata'] as $valuedata)
                    {
                        foreach($valuedata as $valuedata2)
                        {
//                           echo "<pre>";
//                           print_r($valuedata2);
//                           echo "</pre>;";  
//                           exit;
                           if($valuedata2['isactivity']==0&&$date==$valuedata2['dateset'])
                           {
                           if($valuedata2['data']['plugins'])
                           {
                               
                                $arraylatlng['title'][$krow]=$valuedata2['data']['title'];
                                $arraylatlng['simg'][$krow]=$valuedata2['data']['simg']['newpath'];
                                
                                 
                                $check=1;
                               foreach($valuedata2['data']['plugins'] as $valuedata3)
                               {
                                 if($valuedata3['plugid']==5)
                                 {
                                 $check=0;
                                 $arraylatlng['map'][$krow]=$valuedata3['lat'].'|'.$valuedata3['lng'];
                                 break;
                                 }
                               
                               
                               }
                               if($check)
                               {
                               
                               unset($arraylatlng['map'][$krow]);
                               unset($arraylatlng['title'][$krow]);
                               unset($arraylatlng['simg'][$krow]);
                               
                               }else
                               {
                               $krow++;
                               
                               }
                           
                           }
                           
                           
                           }
                        
                        }
                    
                    
                    }

                 
                 }
               
               
               
               }
          
          }
          
          

          }
          

             }
//          

           $this->loaddata('maps',$arraylatlng);
           
           }
        
        
        }
?>
